/*
 * RecordClearThread.h
 *
 *  Created on: 2018年5月17日
 *      Author: zhengboyuan
 */

#ifndef RECORDCLEARTHREAD_H_
#define RECORDCLEARTHREAD_H_

#include "DataStore.h"
#include "TThread.h"
#include "TEvent.h"
#include <string>

class RecordClearSink
{
public:
	virtual ~RecordClearSink() {}

	virtual void onRecordCleared(const std::string& chl, int cleared) =0;
};

class RecordClearThread : public comn::Thread
{
public:
    RecordClearThread(DataStorePtr& dataStore, const char*  chl, RecordClearSink* sink);
    virtual ~RecordClearThread();

protected:
	virtual int run();
	virtual void doStop();

	bool batClear(int& offset);

protected:
	DataStorePtr m_dataStore;
	std::string	 m_channel;
	comn::Event	m_event;

	int	m_cleared;

	RecordClearSink*	m_sink;

};

#endif /* RECORDCLEARTHREAD_H_ */
